extends "../calxJS_Hide/calxJS_Hide.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "小阳"                   # 角色的名称
	attCoe.atkRan = 2                 # 攻击距离
	attCoe.maxHp = 5                  # 最大生命（每点代表112.5基础数值，取整数，下同）
	attCoe.atk = 7                    # 攻击力（每点代表8.5）
	attCoe.mgiAtk = 3                 # 魔法攻击（每点代表13.7）
	attCoe.def = 5                    # 物理防御（每点代表15）
	attCoe.mgiDef = 5                 # 魔法防御（每点代表16.6）
	atkEff = "atk_dao" 
	xb = "光"
	lv = 3   
	addSkillTxt("[三阳开泰]将天地阳极之力凝聚到刀上对目标快速斩击3次，每次造成45%的光系物理伤害\n每次斩击有15%概率提升自身减伤5%，最高20%[CD:7]")
	addSkillTxt("[阳共鸣]与天地之阳共鸣，5秒内受到伤害时恢复已损失生命值的10%[CD:12]")
	addSkillTxt("[天道阳极]使用天道阳极之力挥出刀焰，对物防最低的敌方亚比造成100%光系物理伤害\n若自身血量高于70%，伤害提升35%[CD:15]")
	addCdSkill("sykt",7)
	addCdSkill("ygm",12)
	addCdSkill("tdyj",15)

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "sykt":
		var buff = hasBuff("jianshang1")
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("三阳开泰", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		for i in range(3):
			typeHurtCha(aiCha,att.atk*0.45,Chara.HurtType.PHY,Chara.AtkType.SKILL)
			if sys.rndPer(15):
				if buff == null:
					addBuff(bf.jianshang1.new())
				elif buff.att.defR < 0.2:
					buff.att.defR += 0.05
	if id == "ygm":
		addBuff(ygm1.new(5))
	if id == "tdyj":
		var chas = getAllChas(1)
		var buff:Buff
		chas.sort_custom(self,"sort")
		var dmg = att.atk
		var txt = "天道阳极"
		if att.hp/att.maxHp > 0.7:
			dmg *= 1.35
			txt = "极·" + txt
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText(txt, "#FF0099")
		eff.anim.set_speed_scale(0.2)
		typeHurtCha(chas[0],dmg,Chara.HurtType.PHY,Chara.AtkType.SKILL)

func sort(a, b):
	return a.att.def < b.att.def

class ygm1:
	extends Buff
	func _init(lv = 1):
		attInit()
		isNegetive=false
		life = lv
		var dispelable = false
		id = "ygm1"
	func _connect():
		masCha.connect("onHurt",self,"run")
	func run(AtkInfo):
		masCha.plusHp((masCha.att.maxHp-masCha.att.hp)*0.1)